<div ng-app="userApp">
    <div class="row">    
        <div id="restorepasswordbox" style="margin-top:50px;float:left;" class="mainbox col-md-6 col-md-offset-3 col-sm-8 col-sm-offset-2" ng-controller="loginController">                    
            <div class="panel panel-default" >
                <div class="panel-heading">
                    <div class="panel-title">Nhập mật khẩu mới cho</div>                    
                </div>     

                <div style="padding-top:30px" class="panel-body" >

                   <?php if($message): ?>
                    <div class="alert <?php print $success ? 'alert-success' : 'alert-danger';?> alert-dismissable">
                        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
                        <?php print $message; ?>
                    </div>       
                    <?php endif; ?>

                    <form action="<?php print base_url() . 'user/restorepassword/key/' . $code;?>" method="post" id="restorePasswordForm" name="restorePasswordForm" class="form-horizontal" role="form" novalidate>

                        <div class="form-group" ng-class="{ 'has-error' : restorePasswordForm.password.$error.required && submitted || submitted && restorePasswordForm.password.$error.minlength}">
                            <label for="password" class="col-md-3">Mật khẩu</label>
                            <div class="col-md-9">
                                <input type="password" class="form-control" name="password" ng-minlength="6" ng-model="restorepassword.password" required>
                                <p ng-show="submitted && restorePasswordForm.password.$error.required" class="help-block">Mật khẩu không được để trống.</p>
                                <p ng-show="submitted && restorePasswordForm.password.$error.minlength" class="help-block">Mật khẩu quá ngắn (tối thiểu là 6 kí tự).</p>
                                <p ng-show="submitted && restorePasswordForm.password.$error.maxlength" class="help-block">Username is too long.</p>

                            </div>
                        </div>
                        
                        <div class="form-group" ng-class="{ 'has-error' : restorePasswordForm.passwordConfirm.$error.required && submitted || submitted && restorePasswordForm.passwordConfirm.$error.match}">
                            <label for="passwordConfirm" class="col-md-3">Nhập lại mật khẩu</label>
                            <div class="col-md-9">
                                <input type="password" class="form-control" name="passwordConfirm" ng-model="restorepassword.passwordConfirm" required data-match="restorepassword.password">
                                <p ng-show="submitted && restorePasswordForm.passwordConfirm.$error.required" class="help-block">Mật khẩu xác nhận không được để trống.</p>
                                <p ng-show="submitted && restorePasswordForm.passwordConfirm.$error.match" class="help-block">Mật khẩu không khớp.</p>
                            </div>
                        </div>
                        
                        

                        <div style="margin-top:10px" class="form-group">
                            <!-- Button -->

                            <div class="col-sm-12 controls">
                                <div class="form-group">
                                    <!-- Button -->                                        
                                    <div class="col-md-offset-3 col-md-3">
                                        <button ng-disabled="loadingTracker.active()" data-ng-click="restorePasswordProcess(restorePasswordForm)" id="btn-restorepassword" type="submit" class="btn btn-info btn-sm" data-style="zoom-in">
                                            <span class="ladda-label">Gửi yêu cầu</span>                                               
                                        </button>
                                        <span ng-show="loadingTracker.active()" id="ajax-loading" class="ajax-loading margin-5"></span>
                                    </div> 
                                    <input type="hidden" name="user_id" value="<?php print $user_id;?>">
                                    <?php echo form_hidden($csrf); ?>
                                </div>
                            </div>
                        </div>
                    </form>   
                </div>                     
            </div>  
        </div>
</div>